<template>
  <!-- 来料检任务清单 -->
  <p-card :bordered="false">
    <p-page-header
            style="border: 1px solid rgb(235, 237, 240)"
            :title="title"
    >
      <template slot="extra">

        <p-button key="1" type="primary" @click="saveDataBtn" v-if="!reviewVisible">
          保存
        </p-button>

        <p-popconfirm

                title="确定要提交吗？"
                ok-text="确定"
                cancel-text="取消"
                @confirm="submitData"
                @cancel="cancel"
        >
          <p-button type="primary">提交</p-button>
        </p-popconfirm>

        <p-button key="1" type="danger" @click="saveDataBtn" v-if="!reviewVisible">
          产品锁定
        </p-button>

        <p-button key="1" type="danger" @click="saveDataBtn" v-if="!reviewVisible">
          异常记录
        </p-button>
        <p-button @click="backToIndex">取消</p-button>
      </template>
    </p-page-header>

    <h4 class="title">基础信息</h4>

    <p-form-model
            ref="baseInfoData"
            :model="baseInfoData"
            :rules="rules"
            :label-col="labelCol"
            :wrapper-col="wrapperCol"
    >
      <p-row :gutter="24">
        <p-col :span="8">
          <p-form-model-item ref="inspectBillno" label="送检单号" prop="inspectBillno">
            <p-input
                    readOnly
                    v-model="baseInfoData.inspectBillno"
                    @blur="
          () => {
            $refs.inspectBillno.onFieldBlur();
          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="processBillno" label="工序工单" prop="processBillno">
            <p-input
                    readOnly
                    v-model="baseInfoData.processBillno"
                    @blur="
          () => {
            $refs.processBillno.onFieldBlur();
          }
        "
            >

              <p-tooltip slot="suffix" :title="baseInfoData.processBillno">
                <p-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
              </p-tooltip>
            </p-input>
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="mcode" label="产品编号" prop="mcode">
            <p-input
                    readOnly
                    v-model="baseInfoData.mcode"
                    @blur="
          () => {
            $refs.mcode.onFieldBlur();
          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="mname" label="产品名称" prop="mname">
            <p-input
                    readOnly
                    v-model="baseInfoData.mname"
                    @blur="
          () => {
            $refs.mname.onFieldBlur();
          }
        "
            >
              <p-tooltip slot="suffix" :title="baseInfoData.mname">
                <p-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
              </p-tooltip>
            </p-input>
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="processTwo" label="二级工序" prop="processTwo">
            <p-input
                    readOnly
                    v-model="baseInfoData.processTwo"
                    @blur="
          () => {
            $refs.processTwo.onFieldBlur();
          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="linename" label="线体" prop="linename">
            <p-input
                    readOnly
                    v-model="baseInfoData.linename"
                    @blur="
          () => {
            $refs.linename.onFieldBlur();
          }
        "
            >
              <p-tooltip slot="suffix" :title="baseInfoData.linename">
                <p-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
              </p-tooltip>
            </p-input>
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="sendTime" label="送检时间" prop="sendTime">
            <p-input
                    readOnly
                    v-model="baseInfoData.createTime"
                    @blur="
          () => {

            $refs.sendTime.onFieldBlur();

          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="simpleMethod" label="抽样方式" prop="simpleMethod">

            <p-select  v-model="baseInfoData.simpleMethod" disabled v-if="baseInfoData.simpleMethod==1">
              <p-select-option
                      v-for="(item,index) in inspectMethodList"
                      :key="index"
                      :value="parseInt(item.value)"
              >{{item.title}}</p-select-option>
            </p-select>

            <p-input
                    v-else
                    readOnly
                    v-model="baseInfoData.aqlSimpleStandardName"
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="simpleQty" label="抽样数量" prop="simpleQty">
            <p-input
                    readOnly
                    v-model="baseInfoData.simpleQty"
                    @blur="
          () => {
            $refs.simpleQty.onFieldBlur();
          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="inspecter" label="检验人" prop="inspecter">
            <p-input
                    readOnly
                    v-model="baseInfoData.inspecter"
                    @blur="
          () => {
            $refs.inspecter.onFieldBlur();
          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8">
          <p-form-model-item ref="inspectTime" label="检验时间" prop="inspectTime">
            <p-input
                    readOnly
                    v-model="baseInfoData.inspectTime"
                    @blur="
          () => {
            $refs.inspectTime.onFieldBlur();
          }
        "
            />
          </p-form-model-item>
        </p-col>
        <p-col :span="8" v-if="visible==1&&!reviewVisible">`
          <p-form-model-item ref="sn" label="SN" prop="sn">

            <P-input-search
                    enter-button="添加"
                    v-model="baseInfoData.sn"
                    @search="snPressEnter"
            />
          </p-form-model-item>
        </p-col>
      </p-row>



      <p-modal v-model="phUpVisible" :title="phUpTitle" @ok="phUpSave" okText="保存更改">
        <j-upload v-model="currentPhObj" :trigger-change="true" :ismultiSelect="true"></j-upload>
      </p-modal>

      <p-modal v-model="phReviewVisible" :title="phReviewTitle" :footer="null" :width="1100">

        <p-row style="text-align:center;margin-bottom: 10px;">
          <p-button-group>
            <p-button :disabled="this.phIndex==0" type="primary" icon="left" style="margin-right: 10px" @click="lastPhBtn">  </p-button>
            当前第{{this.phIndex+1}} 张 / 总共 {{this.phObj.length}}张
            <p-button :disabled="this.phIndex==this.phObj.length-1" type="primary" icon="right" @click="nextPhBtn">  </p-button>
          </p-button-group>
        </p-row>
        <p-row>
          <img :src="photoUrl" class="myImg"/>
        </p-row>

      </p-modal>



    <h4 class="title" v-if="visible==1">抽检SN明细</h4>
    <p-table
            v-if="visible==1"
            :columns="simpleSNDetailColumns"
            :data-source="baseInfoData.mesQcTourinspSnDetailList"
            class="components-table-demo-nested"
            bordered
            style="margin-top:10px;"
    >
      <template slot="inspectProjectId" slot-scope="text,record">
        <p-select allowClear showSearch :disabled="reviewVisible" v-model="record.inspectProject"  @change="inspectProjectSelectChange(record.key)">
          <p-select-option

                  v-for="(item) in baseInfoData.mesQcTourinspProjectsList"
                  :key="index"
                  :value="item.inspectProject"
          >{{item.inspectProject}}</p-select-option>
        </p-select>
      </template>

      <template slot="photoUrl" slot-scope="text,record">
        <p-badge :count="record.phObjLength">
          <p-button type="primary" :disabled="reviewVisible" icon="upload" @click="openPhUpBtn(record.key)" >上传</p-button>
        </p-badge>
       <!-- <p-divider type="vertical" />
        <p-button type="primary" icon="download" @click="openPhDownBtn(record.key)">下载</p-button>-->
        <p-divider type="vertical" />
        <p-button type="primary" icon="eye" @click="openPhReviewBtn(record.key)">预览</p-button>
      </template>

      <template slot="remark" slot-scope="text,record">
        <p-textarea :disabled="reviewVisible" v-model="record.remark" :rows="2" />
      </template>


      <template slot="operation" slot-scope="text,record">
        <p-popconfirm
                v-if="!reviewVisible"
                title="确定要删除此项？"
                ok-text="删除"
                cancel-text="取消"
                @confirm="deleteSimpleSNDetail(record)"
        >
          <a href="#">删除</a>
        </p-popconfirm>
      </template>

    </p-table>


      <h4 class="title" >质量判定</h4>

      <p-row>
        <p-col :span="8">
          <p-form-model-item ref="inspectResult" label="检验结论" prop="inspectResult" readOnly>

            <p-tag v-if="baseInfoData.inspectResult==1" color="green"><p-icon type="check-circle" />合格</p-tag>
            <p-tag v-else-if="baseInfoData.inspectResult==2" color="red"><p-icon type="close-circle" />不合格</p-tag>
          </p-form-model-item>
        </p-col>
      </p-row>

    <h4 class="title" v-if="visible==1">检验项目</h4>
    <p-table
            v-if="visible==1"
            :columns="checkProjectColumns"
            :data-source="baseInfoData.mesQcTourinspProjectsList"
            class="components-table-demo-nested"
            bordered
            style="margin-top:10px;"
    >
      <template slot="measuredValue" slot-scope="text,record">

        <p-select v-if="record.valueType==2" v-model="record.measuredValue" :disabled="reviewVisible" placeholder="please select your zone" @change="measuredValueSelectChange">
          <p-select-option
                  v-for="(item,index) in passNgOptions"
                  :key="index"
                  :value="item.value"
          >{{item.name}}</p-select-option>
        </p-select>
        <p-input type="number" v-else :disabled="reviewVisible" v-model="record.measuredValue "  @change="measuredValueInputChange"/>
      </template>

    </p-table>

      <h4 class="title" v-if="visible==1">检验不合格项目</h4>

      <p-table
              v-if="visible==1"
              :columns="checkProjectColumns"
              :data-source="baseInfoData.mesQcTourinspNgRecordList"
              class="components-table-demo-nested"
              bordered
              style="margin-top:10px;"
      >
        <template slot="measuredValue" slot-scope="text,record">

          <p-select  v-if="record.valueType==2" :disabled="reviewVisible" v-model="record.measuredValue" placeholder="please select your zone" @change="measuredValueSelectChange">
            <p-select-option
                    v-for="(item,index) in passNgOptions"
                    :key="index"
                    :value="item.value"
            >{{item.name}}</p-select-option>
          </p-select>
          <p-input  type="number" v-else  v-model="record.measuredValue " :disabled="reviewVisible"  @change="measuredValueInputChange"/>
        </template>

      </p-table>

      <p-page-header
              v-if="visible==2"
              style="border: 1px solid rgb(235, 237, 240)"
              title="检验项目"
      >
        <template slot="extra">

          <p-button key="1" type="primary" @click="addCheckProjectBtn" :disabled="reviewVisible">
            新增行
          </p-button>

        </template>
      </p-page-header>

      <div>
        <p-modal :visible="addCPModalVisible" width="60vw" title="新增行-检验项目" @ok="sureAddCheckProject" @cancel="closeAddCPModal" okText="添加" cancelText="取消">
          <p-alert message="请勾选包含检验明细的检验项目" type="info" v-if="selectedType==1" show-icon />
          <p-alert message="满足条件，点击“添加”按钮插入" type="success" v-if="selectedType==2" show-icon />
          <p-alert message="该项没有对应的明细列表" type="warning" v-if="selectedType==3" show-icon />

          <h4 class="title"></h4>
          <p-table
                  :data-source="templateList"
                  :columns="templateListColumns"
                  :rowSelection="{ selectedRowKeys: selectedRowKeysArray, onChange: onSelectChange, type: 'radio' }"
          >

            <div
                    slot="filterDropdown"
                    slot-scope="{ setSelectedKeys, selectedKeys, confirm, clearFilters, column }"
                    style="padding: 8px"
            >
              <p-input
                      v-ant-ref="c => (searchInput = c)"
                      :placeholder="`搜索 ${column.title}`"
                      :value="selectedKeys[0]"
                      style="width: 188px; margin-bottom: 8px; display: block;"
                      @change="e => setSelectedKeys(e.target.value ? [e.target.value] : [])"
                      @pressEnter="() => handleSearch(selectedKeys, confirm, column.dataIndex)"
              />
              <p-button
                      type="primary"
                      icon="search"
                      size="small"
                      style="width: 90px; margin-right: 8px"
                      @click="() => handleSearch(selectedKeys, confirm, column.dataIndex)"
              >
                搜索
              </p-button>
              <p-button size="small" style="width: 90px" @click="() => handleReset(clearFilters)">
                重置
              </p-button>
            </div>
            <p-icon
                    slot="filterIcon"
                    slot-scope="filtered"
                    type="search"
                    :style="{ color: filtered ? '#108ee9' : undefined }"
            />
            <template slot="customRender" slot-scope="text, record, index, column">
      <span v-if="searchText && searchedColumn === column.dataIndex">
        <template
                v-for="(fragment, i) in text
            .toString()
            .split(new RegExp(`(?<=${searchText})|(?=${searchText})`, 'i'))"
        >
          <mark
                  v-if="fragment.toLowerCase() === searchText.toLowerCase()"
                  :key="i"
                  class="highlight"
          >{{ fragment }}</mark
          >
          <template v-else>{{ fragment }}</template>
        </template>
      </span>
              <template v-else>
                {{ text }}
              </template>
            </template>
          </p-table>

          <h4 class="title"></h4>
          <p-table
                  :data-source="templateListDetails"
                  :columns="templateListDetailsColumns"
          >

          </p-table>


        </p-modal>
      </div>


      <p-table
              v-if="visible==2"
              :columns="modal1InspectionColumns"
              :data-source="baseInfoData.mesQcTourinspLinemList"
              class="components-table-demo-nested"
              bordered
              :expandIcon="expandIcon"
              style="margin-top:10px;"
      >
        <a slot="photoUrl" slot-scope="text">photoUrl</a>

        <template slot="operation" slot-scope="text,record">
          <p-popconfirm
                  v-if="!reviewVisible"
                  title="确定要删除此项？"
                  ok-text="删除"
                  cancel-text="取消"
                  @confirm="deleteCheckProject(record)"
          >
            <a href="#">删除</a>
          </p-popconfirm>
        </template>


        <p-table
                slot="expandedRowRender"
                slot-scope="text"
                :columns="modal1InspectionInnerColumns"
                :data-source="text.mesQcTourinspProjectsList"
                :pagination="false"

                bordered
        >

          <template slot="measuredValue" slot-scope="text,record">

            <p-select v-if="record.valueType==2" v-model="record.measuredValue" :disabled="reviewVisible"  placeholder="please select your zone" @change="measuredValueSelectChange2">
              <p-select-option
                      v-for="(item,index) in passNgOptions"
                      :key="index"
                      :value="item.value"
              >{{item.name}}</p-select-option>
            </p-select>
            <p-input type="number" v-else  v-model="record.measuredValue " :disabled="reviewVisible"  @change="measuredValueInputChange2"/>
          </template>

          <template slot="photoUrl" slot-scope="text,record">

              <p-button type="primary" icon="upload" :disabled="reviewVisible" @click="openPhUpBtn2(record)" >上传</p-button>
            <!-- <p-divider type="vertical" />
             <p-button type="primary" icon="download" @click="openPhDownBtn(record.key)">下载</p-button>-->
            <p-divider type="vertical" v-if="record.photoUrl&&record.photoUrl!=''"/>
            <p-button v-if="record.photoUrl&&record.photoUrl!=''" type="primary" icon="eye" @click="openPhReviewBtn2(record)">预览</p-button>
          </template>

        </p-table>
      </p-table>

      <p-modal v-model="phUpVisible2" title="图片上传" @ok="phUpSave2" okText="保存更改">
        <j-upload v-model="currentDetailPhObj" :trigger-change="true" :ismultiSelect="true"></j-upload>
      </p-modal>

      <div>
        <p-modal v-model="dPhVisible" title="图片预览(非图片文件无法预览-需下载)" :footer="null" :width="1000">
          <img :src="dPhUrl" class="myImg"/>
        </p-modal>
      </div>


      <h4 class="title" v-if="visible==2">检验不合格项目</h4>

      <p-table
              v-if="visible==2"
              :columns="modal1InspectionColumns2"
              :data-source="baseInfoData.mesQcTourinspLinemNgRecordList"
              class="components-table-demo-nested"
              bordered
              :expandIcon="expandIcon2"
              style="margin-top:10px;"
      >
        <a slot="photoUrl" slot-scope="text">photoUrl</a>



        <p-table
                slot="expandedRowRender"
                slot-scope="text"
                :columns="modal1InspectionInnerColumns"
                :data-source="text.mesQcTourinspNgRecordList"
                :pagination="false"

                bordered
        >

          <template slot="measuredValue" slot-scope="text,record">

            <p-select v-if="record.valueType==2" v-model="record.measuredValue" :disabled="reviewVisible" placeholder="please select your zone" @change="measuredValueSelectChange2">
              <p-select-option
                      v-for="(item,index) in passNgOptions"
                      :key="index"
                      :value="item.value"
              >{{item.name}}</p-select-option>
            </p-select>
            <p-input type="number" v-else  v-model="record.measuredValue " :disabled="reviewVisible"  @change="measuredValueInputChange2"/>
          </template>

          <template slot="photoUrl" slot-scope="text,record">
            <p-button v-if="record.photoUrl&&record.photoUrl!=''" :disabled="reviewVisible" type="primary" icon="eye" @click="openPhReviewBtn2(record)">预览</p-button>
          </template>

        </p-table>
      </p-table>

    </p-form-model>
  </p-card>
</template>

<script>

import Operation1 from "@/components/mesCom/mesQc/MesQcTourInspectOperation/Operation1.vue";
import Operation2 from "@/components/mesCom/mesQc/MesQcTourInspectOperation/Operation2.vue";
import {getAction, postAction, deleteAction, putAction} from "../../../api/manage";
import JUpload from '@/components/jeecg/JUpload'
import dayjs from "dayjs";


export default {
  name: "MesQcTourInspectOperation",
  props:['mqVisible','mqLoad','mqData'],
  components: {
    JUpload,
  },

  data() {
    return {
      labelCol: { span: 8 },
      wrapperCol: { span: 14 },
       visible:1,  //通过设置visible的值（1或者2）来显示不同类型的检验操作
      title:'',
      //新增行弹出框
      addCPModalVisible:false,
      templateList:[],
      templateListDetails:[],
      selectedRowKeysArray:[],
      selectedRows:[],
      selectedType:1,

      reviewVisible:false,

      phUpVisible:false,
      phUpVisible2:false,

      dPhVisible:false,
      dPhUrl:'',

      currentDetailPhObj:'',

      currentD:{},

      phUpTitle:'',

      currentSnPhKey:0,

      phReviewVisible:false,
      phReviewTitle:'',
      currentPhObj:[],

      photoUrl:'',
      phObj:[],
      phIndex:[],

      inspectMethodList:[],
      inspectMethodMap:[],

      standardUnitList:[],
      standardUnitMap:[],

      questionLevelList:[],
      questionLevelMap:[],



      // 进料检验类型数据
      modal1InspectionColumns: [
        {
          title: "序号",
          dataIndex: "key",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          },
        },
        { title: "线号/组件编号", dataIndex: "lineBillno", key: "lineBillno" },
        { title: "物料编码", dataIndex: "mcode", key: "mcode" },
        { title: "物料名称", dataIndex: "mname", key: "mname" },
        { title: "物料一级分类", dataIndex: "productOneType", key: "productOneType" },
        { title: "物料二级分类", dataIndex: "productTwoType", key: "productTwoType" },
        { title: "物料三级分类", dataIndex: "productThreeType", key: "productThreeType" },

        { title: "检验结果",
          dataIndex: "inspectResult",
          key: "inspectResult",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'合格':'不合格';
            }
          },
        },

        {title:"操作",key:"id",dataIndex: 'id',scopedSlots: {customRender: "operation"}}
      ],

      modal1InspectionColumns2: [
        {
          title: "序号",
          dataIndex: "key",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          },
        },
        { title: "线号/组件编号", dataIndex: "lineBillno", key: "lineBillno" },
        { title: "物料编码", dataIndex: "mcode", key: "mcode" },
        { title: "物料名称", dataIndex: "mname", key: "mname" },
        { title: "物料一级分类", dataIndex: "productOneType", key: "productOneType" },
        { title: "物料二级分类", dataIndex: "productTwoType", key: "productTwoType" },
        { title: "物料三级分类", dataIndex: "productThreeType", key: "productThreeType" },

        { title: "检验结果",
          dataIndex: "inspectResult",
          key: "inspectResult",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'合格':'不合格';
            }
          },
        },

      ],

      modal1InspectionInnerColumns: [
        {
          title: "序号",
          dataIndex: "key",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          },

        },
        { title: "工站", dataIndex: "workStation", key: "workStation" },
        { title: "检验项目", dataIndex: "inspectProject", key: "inspectProject" },
        {
          title: "检验标准",
          key: "inpectStandard",
          dataIndex: "inpectStandard",
        },
        {
          title: "值类型",
          key: "valueType",
          dataIndex: "valueType",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'计量型':'计数型';
            }
          },
        },
        { title: "检验手段", dataIndex: "inspectMethod", key: "inspectMethod",
          customRender: (text) => {
            return this.inspectMethodMap[text]?this.inspectMethodMap[text].title:'';
          },
        },
        { title: "参数", dataIndex: "param", key: "param" },
        { title: "单位", dataIndex: "standardUnit", key: "standardUnit",
          customRender: (text) => {
            return this.standardUnitMap[text].title;
          },
        },

        { title: "标准值", dataIndex: "standardValue", key: "standardValue" },

        {
          title: "上限值",
          dataIndex: "upperValue",
          key: "upperValue",

        },
        { title: "下限值", dataIndex: "downValue", key: "downValue" },
        {
          title: "实测值",
          dataIndex: "measuredValue",
          key: "measuredValue",
          scopedSlots: { customRender: "measuredValue" },
        },
        {
          title: "单项判定",
          dataIndex: "individualJudgment",
          key: "individualJudgment",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'PASS':'NG';
            }
          },
        },
        { title: "缺陷等级", dataIndex: "flawLevel", key: "flawLevel",
          customRender: (text) => {
            return this.questionLevelMap[text].title;
          },
        },
        {
          title: "图片",
          dataIndex: "photoUrl",
          key: "photoUrl",
          scopedSlots: { customRender: "photoUrl" },
        },


      ],

      templateListColumns:[
        { title: "线号/组件编号", dataIndex: "lineBillno", key: "lineBillno",
          scopedSlots: {
            filterDropdown: 'filterDropdown',
            filterIcon: 'filterIcon',
            customRender: 'customRender',
          },
          onFilter: (value, record) =>
                  record.lineBillno
                          .toString()
                          .toLowerCase()
                          .includes(value.toLowerCase()),
          onFilterDropdownVisibleChange: visible => {
            if (visible) {
              setTimeout(() => {
                this.searchInput.focus();
              }, 0);
            }
          },
        },
        { title: "物料编码", dataIndex: "mcode", key: "mcode" },
        { title: "物料名称", dataIndex: "mname", key: "mname" },
      ],
      templateListDetailsColumns:[
        { title: "检验项目", dataIndex: "inspectProject", key: "inspectProject" },
        { title: "检验标准", dataIndex: "inpectStandard", key: "inpectStandard" },
        { title: "值类型", dataIndex: "valueType", key: "valueType",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'计量型':'计数型';
            }
          },
        },
        { title: "标准值", dataIndex: "standardValue", key: "standardValue" },
        { title: "单位", dataIndex: "standardUnit", key: "standardUnit",
          customRender: (text) => {
           return this.standardUnitMap[text].title;
          },
        },

        { title: "上限值", dataIndex: "upperValue", key: "upperValue" },
        { title: "下限值", dataIndex: "downValue", key: "downValue" },
        { title: "参数", dataIndex: "param", key: "param" },
        { title: "缺陷等级", dataIndex: "flawLevel", key: "flawLevel",
          customRender: (text) => {
            return this.questionLevelMap[text].title;
          },
        },
      ],

      passNgOptions:[
        {
          name: "PASS",
          value: "PASS",
        },
        {
          name: "NG",
          value: "NG",
        },
      ],
      measuredValueOptions: [
        {
          name: "pass",
          value: 1,
        },
        {
          name: "NG",
          value: 2,
        },
      ],
      checkProjectColumns:[
        {
          title: "序号",
          dataIndex: "",
          key: "rowIndex",
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          },
        },
        { title: "工站", dataIndex: "workStation", key: "workStation" },
        { title: "检验项目", dataIndex: "inspectProject", key: "inspectProject" },
        { title: "检验标准", dataIndex: "inpectStandard", key: "inpectStandard" },
        { title: "值类型", dataIndex: "valueType", key: "valueType",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'计量型':'计数型';
            }
          },
        },
        { title: "检验手段", dataIndex: "inspectMethod", key: "inspectMethod",
          customRender: (text) => {
            return this.inspectMethodMap[text]?this.inspectMethodMap[text].title:'';
          },
        },
        { title: "参数", dataIndex: "param", key: "param" },
        { title: "单位", dataIndex: "standardUnit", key: "standardUnit",
          customRender: (text) => {
            return this.standardUnitMap[text]?this.standardUnitMap[text].title:'';
          },
        },
        { title: "标准值", dataIndex: "standardValue", key: "standardValue", scopedSlots: { customRender: "standardValue" }, },

        {
          title: "上限值",
          dataIndex: "upperValue",
          key: "upperValue",
          scopedSlots: { customRender: "upperValue" },
        },
        { title: "下限值", dataIndex: "downValue", key: "downValue" , scopedSlots: { customRender: "downValue" },},

        {
          title: "实测值",
          dataIndex: "measuredValue",
          key: "measuredValue",
          scopedSlots: { customRender: "measuredValue" },
        },
        {
          title: "单项判定",
          dataIndex: "individualJudgment",
          key: "individualJudgment",
          customRender: (text) => {
            if (!text) {
              return "";
            } else {
              return text==1?'PASS':'NG';
            }
          },

        },
        { title: "缺陷等级", dataIndex: "flawLevel", key: "flawLevel",
          customRender: (text) => {
            return this.questionLevelMap[text]?this.questionLevelMap[text].title:'';
          },
        },
      ],
      checkProjectData:[],
      simpleSNDetailColumns:[
        {
          title: "序号",
          dataIndex: "",
          key: "rowIndex",
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          },
        },
        {
          title: "SN",
          dataIndex: "sn",
        },
        {
          title: "检验项目",
          dataIndex: "inspectProjectId",
          scopedSlots: {customRender: "inspectProjectId"},
        },
        {
          title: "图片",
          dataIndex: "photoUrl",
          scopedSlots: {customRender: "photoUrl"},
        },
        {
          title: "备注",
          dataIndex: "remark",
          scopedSlots: {customRender: "remark"},
        },
        {title:"操作",key:"id",dataIndex: 'id',scopedSlots: {customRender: "operation"}}
      ],
      simpleSNDetailData:[],

      baseInfoData: {
        //基础信息
        inspectBillno: "001", //送检单号
        processBillno: "", //工序工单
        mcode: "001", //产品编号
        mname: "", //产品名称
        processTwo: "", //二级工序
        linename: "", //线体
        createTime: "", //送检时间


        simpleMethod: "", //抽样方式
        simpleQty: "3", //抽样数量
        inspecter: "", //检验人
        inspectTime: "", //检验时间
        sn: "", //sn
        inspectResult: 1,
      },

      rules: {
        inspectBillno: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        processBillno: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        mcode: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        mname: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        processTwo: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        linename: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        sendTime: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        simpleMethod: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        simpleQty: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        inspecter: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],
        inspectTime: [
          {
            required: true,
            message: "Please input Activity name",
            trigger: "blur",
          },
        ],

      },




    };
  },


  computed: {
    
  },

  created() {
    this.initStandardUnitList();
    this.initQuestionLevelList();
    this.initInspectMethodList();
   this.mqListener();
  },

  methods: {
    handleSearch(selectedKeys, confirm, dataIndex) {
      confirm();
      this.searchText = selectedKeys[0];
      this.searchedColumn = dataIndex;
      this.resetRadioSelect();
    },
    handleReset(clearFilters) {
      clearFilters();
      this.searchText = '';
      this.resetRadioSelect();
    },
    mqListener(){
      console.log(this.mqVisible)
      console.log(this.mqLoad)
      console.log(this.mqData)
      this.initData(this.mqData);
    },
    backToIndex(){
      let mqData = this.mqData;
      this.$emit('update:mqVisible', 1);
      this.$emit('update:mqLoad', false);
      mqData.id = 0;
      mqData.isPallet = "";
      mqData.inspectStatus = "";
      this.$emit('update:mqData', mqData);
    },

    /**
     * 展开图标
     * @param props
     * @returns {string|*}
     */
    expandIcon(props){
      if(props.record.mesQcTourinspProjectsList&&props.record.mesQcTourinspProjectsList.length>0){

        if (props.expanded) {
          return <p-icon type='minus-square' onClick={e => {props.onExpand(props.record, e);}}/>;
        }else{
          return <p-icon type='plus-square' onClick={e => {props.onExpand(props.record, e);}}/>;
        }

      }else{
        return "";
      }
    },


    expandIcon2(props){
      if(props.record.mesQcTourinspNgRecordList&&props.record.mesQcTourinspNgRecordList.length>0){

        if (props.expanded) {
          return <p-icon type='minus-square' onClick={e => {props.onExpand(props.record, e);}}/>;
        }else{
          return <p-icon type='plus-square' onClick={e => {props.onExpand(props.record, e);}}/>;
        }

      }else{
        return "";
      }
    },
    //加载数据
    initData(query){

      if(!query.id){
        this.$message.warning("请通过巡检任务清单选择单号进入！");
      }else {
        let id = query.id;
        let isPallet = query.isPallet;
        if(isPallet==1){
          this.title='巡检操作（线材预制）';
          this.visible = 2;
        }else{
          this.title='巡检操作';
          this.visible = 1;
        }

        getAction('/mes-quality/mesQcTourInspectTask/selectById',{id:id}).then(res=>{
          if (res.success) {
            if(res.code!=0){
              this.$message.warning(res.msg)
            }
            let data = res.data;

            data.createTime = dayjs(data.createTime).format("YYYY-MM-DD HH:mm:ss")

            if(data.inspectStatus==6){
              this.reviewVisible = true;

            }

           /* if(data.inspectStatus==2){
              if(data.isPallet==1){
                if(data.mesQcTourinspLinemNotInspectList.length==0){
                  this.$message.error('检验项目查询不到该物料的检验项目模板');
                }
              }else{
                if(data.mesQcTourinspProjectsList.length==0){
                  this.$message.error('检验项目查询不到该物料的检验项目模板');
                }
              }
            }*/

            if(data.mesQcTourinspSnDetailList.length>0){
              let key = 1;
              data.mesQcTourinspSnDetailList.forEach(item=>{
                item.key = key;
                item.phObj = [];
                item.phObjLength  = 0;

                if(item.inspectProject&&item.inspectProject!=''){
                  if(item.sonPhotoUrl&&item.sonPhotoUrl!=''){
                    let phObj = JSON.parse(item.sonPhotoUrl);
                    if(phObj.length>0){
                      item.phObj = phObj;
                      item.phObjLength = phObj.length;
                    }
                  }
                }else{
                  if(item.photoUrl&&item.photoUrl!=''){
                    let phObj = JSON.parse(item.photoUrl);
                    if(phObj.length>0){
                      item.phObj = phObj;
                      item.phObjLength = phObj.length;
                    }
                  }
                }


                key = key +1;
              })
            }


            if(data.mesQcTourinspLinemList.length>0){
              let key = 1;
              data.mesQcTourinspLinemList.forEach(item=>{
                item.key = key;


                if(item.mesQcTourinspProjectsList.length>0){
                  let sonKey = 1;
                  item.mesQcTourinspProjectsList.forEach(jtem=>{
                    jtem.key = sonKey;
                    jtem.fKey = key;
                    sonKey = sonKey + 1;
                  })
                }
                key= key +1;

              })
            }

            this.baseInfoData = data;
            this.templateList = data.mesQcTourinspLinemNotInspectList;
            this.phUpVisible = false;

            console.log('-----------------dd------------------')
            console.log(data)
            this.checkProjectDataReset();
          } else {
            this.$message.warning(res.msg);
          }
        })
      }

    },

    initInspectMethodList(){
      getAction('/basic-business/sys/dict/queryDictItemsByCode',{dictCode:'rc_inspect_method'}).then(res=>{
        if(res.success){
          this.inspectMethodList = res.data;
          this.inspectMethodMap = this.listToMap(this.inspectMethodList,'value');
        }
      })
    },

    initStandardUnitList(){
      getAction('/basic-business/sys/dict/queryDictItemsByCode',{dictCode:'mes_details_tamplate_unit'}).then(res=>{
        if(res.success){
          this.standardUnitList = res.data;
          this.standardUnitMap = this.listToMap(this.standardUnitList,'value');
        }
      })
    },

    initQuestionLevelList(){
      getAction('/basic-business/sys/dict/queryDictItemsByCode',{dictCode:'mes_err_level'}).then(res=>{
        if(res.success){
          this.questionLevelList = res.data;
          this.questionLevelMap = this.listToMap(this.questionLevelList,'value');
        }
      })
    },


    /**
     * 点击‘新增行’按钮
     */
    addCheckProjectBtn(){
      this.addCPModalVisible = true;
    },

    //删除检验项目（线材预制）
    deleteCheckProject(e){
      let id = e.id;
      if(id){
        deleteAction('/mes-quality/mesQcTourInspectTask/deleteLinemInspectProjectByLinemId/'+id).then(res=>{
          if(res.success){
            this.$message.success("删除成功");
            this.initData(this.mqData);
          }else{
            this.$message.warning(res.msg);
          }
        })
      }else{

      }
    },

    /**
     * 确定添加
     */
    sureAddCheckProject(){

      let data = this.baseInfoData;
      putAction('/mes-quality/mesQcTourInspectTask/saveTourInspect',data).then(res=>{
        if(res.success){
          let data2 = this.selectedRows[0];
          data2.mesPitId = this.baseInfoData.id;
          putAction('/mes-quality/mesQcTourInspectTask/addLinemInspectProject',data2).then(res=>{
            if(res.success){
              this.$message.success("新增成功！");
              this.resetRadioSelect();
              this.addCPModalVisible = false;
              this.initData(this.mqData);
            }else{
              this.$message.warning(res.msg);
            }
          })
        }else{
          this.$message.warning(res.msg);
        }
      })



    },

    /**
     * 取消-关闭modal
     */
    closeAddCPModal(){
      this.resetRadioSelect();
      this.addCPModalVisible = false;
    },

    /**
     *加载检验项目列表
     */
    initSampleTemplateList(sendBillno){

      getAction('/mes-quality/mesQcIncomeBasicInfo/querySampleTemplateList/'+ sendBillno).then(res=>{

        if (res.success) {
          let data = res.data;
          this.templateList = data;
        } else {
          this.$message.warning("后台获取检验项目列表报错");
        }
      })
    },

    /**
     * 重设radio
     */
    resetRadioSelect(){
      this.selectedRowKeysArray = [];
      this.selectedRows = [];
      this.templateListDetails = [];
      this.selectedType = 1;
    },

    /**
     * 检验项目单选框change事件
     */
    onSelectChange(selectedRowKeys, selectedRows){
      this.selectedRowKeysArray = selectedRowKeys;
      this.selectedRows = selectedRows;
      this.templateListDetails = selectedRows[0].mesQcTourinspProjectsList;
      if(this.templateListDetails.length>0){
        this.selectedType=2
      }else{
        this.selectedType=3
      }
    },

    dataSet(){
      let data = this.baseInfoData;
      if(this.visible==1){
        //非线材
        this.baseInfoData.mesQcTourinspSnDetailList.forEach(item=>{

          item.inspectProjectList = [
            {inspectProjectId:123,inspectProject:'123'},
            {inspectProjectId:456,inspectProject:'456'},
            {inspectProjectId:234,inspectProject:'234'},
            {inspectProjectId:789,inspectProject:'789'},
          ];
        })




      }else{
        this.initSampleTemplateList('a');
      }

      this.checkProjectDataReset();
    },

    //删除抽检sn明细
    deleteSimpleSNDetail(record){

      let data ={
        sendInspectSnId:record.id,
        taskId:this.baseInfoData.id
      }

      postAction('/mes-quality/mesQcTourInspectTask/deleteTourSendProductDetail',data).then(res=>{
        if(res.success){
          this.$message.success("删除成功！");
          let listData = res.data;
          this.baseInfoData.mesQcTourinspSnDetailList = listData;
        }else{
          this.$message.error(res.msg)
        }
      })
    },

    openPhUpBtn2(record){
      console.log(record)
      this.currentD = record;
      this.currentDetailPhObj = record.photoUrl;
      this.phUpVisible2 = true;

    },

    openPhReviewBtn2(record){
      this.dPhVisible = true;
      let obj = JSON.parse(record.photoUrl);
      this.dPhUrl = obj[0].filePath;
    },

    phUpSave2(){
      let data = {
        id:this.currentD.id,
        photoUrl:this.currentDetailPhObj
      }

      let r = this.currentD;
      postAction('/mes-quality/mesQcTourInspectTask/updateInspectProject',data).then(res=>{
        if(res.success){
          this.$message.success('操作成功!');
          this.phUpVisible2 = false;
          this.baseInfoData.mesQcTourinspLinemList[r.fKey-1].mesQcTourinspProjectsList[r.key-1].photoUrl = this.currentDetailPhObj;
        }else{
          this.$message.warning(res.msg)
        }
      })
    },

    openPhUpBtn(key){
      this.currentSnPhKey = key;
      let data = this.baseInfoData.mesQcTourinspSnDetailList[key-1];
      if(data.inspectProject&&data.inspectProject!=''){
        this.currentPhObj = data.sonPhotoUrl;
      }else{
        this.currentPhObj = data.photoUrl;
      }

      this.phUpVisible = true;

      this.phUpTitle = '['+data.sn+']'+'-'+'图片上传'
    },

    openPhDownBtn(key){
      let data = this.baseInfoData.mesQcTourinspSnDetailList[key-1];
      let obj ;
      if(data.inspectProject&&data.inspectProject!=''){
        obj = JSON.parse(data.sonPhotoUrl);
      }else{
        obj = JSON.parse(data.photoUrl);
      }
      if(obj.length==0){
        this.$message.warning('暂无图片,请上传！');
      }else{
        obj.forEach(item=>{

        this.sleepTime(500);
        console.log(item.filePath)
        this.downLoadFile(item.filePath);
        })
      }
    },

    sleepTime(d){
      for(var t = Date.now();Date.now() - t <= d;);
    },

    downLoadFile(filePath){
      window.open(filePath);
    },


    openPhReviewBtn(key){
      let data = this.baseInfoData.mesQcTourinspSnDetailList[key-1];

      this.phReviewTitle = '['+data.sn+']'+'-'+'图片预览'

      let obj ;
      if(data.inspectProject&&data.inspectProject!=''){
        obj = JSON.parse(data.sonPhotoUrl);
      }else{
        obj = JSON.parse(data.photoUrl);
      }



      let phObj = [];
      if(obj&&obj.length>0){
        phObj = obj;
        let filePath = obj[0].filePath;
        filePath = filePath.substring(filePath.indexOf('=')+1)
        this.photoUrl = filePath;
      }else{
        this.photoUrl = '';
      }
      this.phObj = phObj;
      this.phIndex = 0;

      this.photoVisible=true;

      if(this.phObj.length==0){
        this.$message.warning('暂无图片,请上传！');
      }else{
        this.phReviewVisible = true;
      }


    },

    nextPhBtn(){
      console.log(this.phObj)
      console.log('------------------')
      console.log(this.phObj[this.phIndex+1])
      this.phIndex = this.phIndex+1;

      let filePath = this.phObj[this.phIndex].filePath;
      filePath = filePath.substring(filePath.indexOf('=')+1)
      this.photoUrl = filePath;
    },

    lastPhBtn(){
      this.phIndex = this.phIndex-1;

      let filePath = this.phObj[this.phIndex].filePath;
      filePath = filePath.substring(filePath.indexOf('=')+1)
      this.photoUrl = filePath;
    },

    phUpSave(){
      let key = this.currentSnPhKey;
      let data = this.baseInfoData.mesQcTourinspSnDetailList[key-1];


      if(!data.inspectProject||data.inspectProject==''){
        data.photoUrl = this.currentPhObj;
        this.saveDataBtn();
      }else{
        let d = {
          id:data.id,
          inspectProject:data.inspectProject,
          photoUrl:this.currentPhObj
        }
        postAction('/mes-quality/mesQcTourInspectTask/updateTourSendProductDetail',d).then(res=>{
          if(res.success){
            this.$message.success('保存成功！');
            this.initData(this.mqData);
            this.phUpVisible = false;
          }else{
            this.$message.warning(res.msg)
          }
        })
      }
    },

    //抽检sn明细下拉框变更
    inspectProjectSelectChange(key){

      let data = this.baseInfoData.mesQcTourinspSnDetailList[key-1];
      if(!data.inspectProject||data.inspectProject==''){

        let phObj =[];
        let phObjLength = 0;
        if(data.photoUrl&&data.photoUrl!=''){
          phObj = JSON.parse(data.photoUrl);
          phObjLength = phObj.length;
        }

        this.baseInfoData.mesQcTourinspSnDetailList[key-1].phObj = phObj;
        this.baseInfoData.mesQcTourinspSnDetailList[key-1].phObjLength = phObjLength;


      }else{
        let d = {
          id:data.id,
          inspectProject:data.inspectProject
        };

        postAction('/mes-quality/mesQcTourInspectTask/selectInspectSn',d).then(res=>{
          if(res.success){
            this.baseInfoData.mesQcTourinspSnDetailList[key-1].sonPhotoUrl = res.data.sonPhotoUrl;

            let phObj =[];
            let phObjLength = 0;

            if(res.data.sonPhotoUrl&&res.data.sonPhotoUrl!=''){
              phObj = JSON.parse(res.data.sonPhotoUrl);
              phObjLength = phObj.length;
            }

            this.baseInfoData.mesQcTourinspSnDetailList[key-1].phObj = phObj;
            this.baseInfoData.mesQcTourinspSnDetailList[key-1].phObjLength = phObjLength;


          }else{
            this.$message.warning(res.msg)
          }
        })
      }
    },

    //封装listToMap
    listToMap(list,name){
      let map = {};
      for(let i in list){
        map[list[i][name]] = list[i];
      }
      return map;
    },

    //sn回车事件
    snPressEnter(e){
      let sn = this.baseInfoData.sn;
      let flag = true;

        if(!sn||sn===''){
          flag = false;
        this.$message.error("SN不能为空！")
        }else{
          if (sn.trim()=='') {
            flag = false;
            this.$message.error("SN不能为纯空格的字符串！")
          }
        }

        if(flag){
          let data = this.baseInfoData;
          let data2 ={
            taskId:this.baseInfoData.id,
            sn:sn
          }
          putAction('/mes-quality/mesQcTourInspectTask/saveTourInspect',data).then(res=>{
            if(res.success){
              postAction('/mes-quality/mesQcTourInspectTask/checkInspectSn',data2).then(res=>{
                if(res.success){
                  this.$message.success("新增SN成功！");
                  this.initData(this.mqData);
                }else{
                  this.$message.error(res.msg)
                }
              })
            }else{
              this.$message.warning(res.msg);
            }
          })


        }




    },

    //实测值-下拉框change事件
    measuredValueSelectChange(){
      this.checkProjectDataReset();
    },
    measuredValueSelectChange2(){
      this.checkProjectDataReset();
    },

    //实测值输入框change事件
    measuredValueInputChange(){
      this.checkProjectDataReset();
    },
    measuredValueInputChange2(){
      this.checkProjectDataReset();
    },

    //检验项目表联动重置-用于非线材预制
    checkProjectDataReset(){
      let resultFlag = true;
      if(this.visible==1){
        this.baseInfoData.mesQcTourinspProjectsList.forEach(item=>{
          let measuredValue  = item.measuredValue;
          if(item.valueType==2){

            if(measuredValue=='PASS'){
              item.individualJudgment =1
            }else{
              item.individualJudgment =2
              resultFlag = false;
            }

          }else{
            if((item.upperValue&&item.upperValue!='')&&(!item.downValue||item.downValue=="")){
              if(measuredValue<=item.upperValue){
                item.individualJudgment = 1;
              }else{
                item.individualJudgment = 2;
                resultFlag = false;
              }
            }else if((item.downValue&&item.downValue!='')&&(!item.upperValue||item.upperValue=="")){
              console.log(111111111111111111)
              if(measuredValue>=item.downValue){
                item.individualJudgment = 1;
              }else{
                item.individualJudgment = 2;
                resultFlag = false;
              }
            }else{
              if(measuredValue<=item.upperValue&&measuredValue>=item.downValue){
                item.individualJudgment = 1;
              }else{
                item.individualJudgment = 2;
                resultFlag = false;
              }
            }



          }

        })
        if(this.baseInfoData.mesQcTourinspProjectsList.length>0){
          this.baseInfoData.inspectResult = resultFlag?1:2;
        }else{
          this.baseInfoData.inspectResult = resultFlag = 2
        }


      }else{
        this.baseInfoData.mesQcTourinspLinemList.forEach(item=>{
          let flag = true;
          item.mesQcTourinspProjectsList.forEach(item2=>{
            let measuredValue  = item2.measuredValue;
            if(item2.valueType==2){
              if(measuredValue=='PASS'){
                item2.individualJudgment =1
              }else{
                item2.individualJudgment =2
                resultFlag = false;
              }
            }else{


              if((item2.upperValue&&item2.upperValue!='')&&(!item2.downValue||item2.downValue=="")){
                if(item2.measuredValue<=item2.upperValue){
                  item2.individualJudgment = 1;
                }else{
                  item2.individualJudgment = 2;
                  flag = false;
                  resultFlag = false;
                }
              }else if((item2.downValue&&item2.downValue!='')&&(!item2.upperValue||item2.upperValue=="")){
                if(item2.measuredValue>=item2.downValue){
                  item2.individualJudgment = 1;
                }else{
                  item2.individualJudgment = 2;
                  flag = false;
                  resultFlag = false;
                }
              }else{
                if(item2.measuredValue<=item2.upperValue&&item2.measuredValue>=item2.downValue){
                  item2.individualJudgment = 1;
                }else{
                  item2.individualJudgment = 2;
                  flag = false;
                  resultFlag = false;
                }
              }

            }

          })
          if(item.mesQcTourinspProjectsList.length>0){
            item.inspectResult = flag?1:2;
          }else{
            item.inspectResult = 2;
            resultFlag = false;
          }


        })

        if(this.baseInfoData.mesQcTourinspLinemList.length>0){
          this.baseInfoData.inspectResult = resultFlag?1:2;
        }else{
          this.baseInfoData.inspectResult = resultFlag = 2
        }
      }




    },

    //保存
    saveDataBtn(){
      let data = this.baseInfoData;
      putAction('/mes-quality/mesQcTourInspectTask/saveTourInspect',data).then(res=>{
        if(res.success){
          this.$message.success("保存成功");
          this.initData(this.mqData);
          this.phReviewVisible = false;
        }else{
          this.$message.warning(res.msg);
        }
      })
    },


    //提交
    submitData(){
      let data = this.baseInfoData;
      putAction('/mes-quality/mesQcTourInspectTask/updateTourInspect',data).then(res=>{
        if(res.success){
          this.$message.success("提交成功");
          this.backToIndex()
        }else{
          this.$message.warning(res.msg);
        }
      })
    },






  },
};
</script>
<style scoped>
@import "~@assets/less/common.less";
.myImg{
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
.title {
  padding: 8px 12px;
  background: #fafafa;
}
.title:not(:first-child) {
  margin-top: 25px;
}
/deep/ .poros-form{
  margin-top:15px;
}
/deep/ .poros-table-body {
  overflow-x: auto !important;
}
/deep/ .poros-col{
  min-height: 54px;
}

/* For demo */
/* For demo */
/* For demo */
.ant-carousel >>> .slick-slide {
  text-align: center;
  height: 160px;
  line-height: 160px;
  background: #364d79;
  overflow: hidden;
}

.ant-carousel >>> .custom-slick-arrow {
  width: 25px;
  height: 25px;
  font-size: 25px;
  color: #fff;
  background-color: rgba(31, 45, 61, 0.11);
  opacity: 0.3;
}
.ant-carousel >>> .custom-slick-arrow:before {
  display: none;
}
.ant-carousel >>> .custom-slick-arrow:hover {
  opacity: 0.5;
}

.ant-carousel >>> .slick-slide h3 {
  color: #fff;
}
.highlight {
  background-color: rgb(255, 192, 105);
  padding: 0px;
}
</style>
